/*
 *
 * 名称：鈢㔉奇门窗口
 * 功能：显示主窗口
 * 作者：清河张
 * 时间：2025.05.11
 *
 */

#ifndef XZQMWIN_H
#define XZQMWIN_H

#include <QMainWindow>
#include <QByteArray>
#include <QJsonObject>
#include "base/lifa.h"
#include "qmdj/qmgong9.h"
#include "wylq/wylqwin.h"
#include "qmdjwin.h"

namespace Ui {
class XZQMWIN;
}

namespace QMDJ
{

class XZQMWIN : public QMainWindow
{
    Q_OBJECT

    enum{
        PAN_SHOUPAN,
        PAN_QICE,
    }PAN;


public:

    explicit XZQMWIN(QWidget *parent = nullptr );

    ~XZQMWIN();

    //加载配置
    bool loadcfg();

    //保存配置
    bool savecfg();

    //控件响应槽函数
private slots:

    void on_glDateTimeEdit1_dateTimeChanged(const QDateTime &dateTime);

    void on_decDayToolButton1_clicked();

    void on_incDayToolButton1_clicked();

    void on_resetDateTimePushButton1_clicked();

    void on_curDateTimePushButton1_clicked();

    void on_syncTimePushButton1_clicked();

    void on_glDateTimeEdit2_dateTimeChanged(const QDateTime &dateTime);

    void on_decDayToolButton2_clicked();

    void on_incDayToolButton2_clicked();

    void on_resetDateTimePushButton2_clicked();

    void on_curDateTimePushButton2_clicked();

    void on_syncTimePushButton2_clicked();

    void on_banToolButton_clicked();

    void on_copyToolButton_clicked();

    void on_dayingToolButton_clicked();

    void on_clearToolButton_clicked();

    void on_dingzhuToolButton_clicked();

    void on_dingjuComboBox_currentIndexChanged(int index);

    void on_addFanganToolButton_clicked();

    void on_editFanganToolButton_clicked();

    void on_rmFanganToolButton_clicked();

    void on_fanganComboBox_currentIndexChanged(int index);

private:

    //奇门遁甲断局
    void qmdjDuan(const QDateTime &dateTime1, const QDateTime &dateTime2);

    //将dateTime时间信息输出到str中
    void addTimeInfo(const QDateTime &dateTime, QByteArray& str);

    virtual void closeEvent(QCloseEvent *event);

    Ui::XZQMWIN *ui;
    QByteArray _duan;
    PARAS _paras;
    QMDJWIN * _qmdjwin;
    WYLQWIN * _wylqwin;
    FANGANWIN* _qmfawin;
    QMGONG9 _gong9;
    FANGAN _fangan;
    QJsonObject _jsonObj;
};

};

#endif // XZQMWIN_H
